package Ex1;

import java.util.Scanner;

public class Ex08_Q35 {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int dan = 150000;
		int won = 67430;
		System.out.println("물건 값 입력");
		// won=scan.nextInt();

		System.out.println("내가 낼돈 입력");
		// dan=scan.nextInt();
		int jan;

		
		jan = dan - won;

		int[] a = new int[9];
		int[] b = new int[9];
		a[1] = jan / 50000;
		b[1] = jan % 50000;
		System.out.println("5만원권" + a[1] + "장");
		a[2] = b[1] / 10000;
		System.out.println("1만원짜리" + a[2] + "장");
		b[2] = b[1] % 10000;

		a[3] = b[2] / 5000;
		System.out.println("5천원짜리" + a[3]);
		b[3] = b[2] % 5000;

		a[4] = b[3] / 1000;
		System.out.println("1천원짜리" + a[4]);
		b[4] = b[3] % 1000;

		a[5] = b[4] / 500;
		System.out.println("5백원짜리" + a[5]);
		b[5] = b[4] % 500;

		a[6] = b[5] / 100;
		System.out.println("1백원짜리" + a[6]);
		b[6] = b[5] % 100;

		a[7] = b[6] / 50;
		System.out.println("5십원짜리" + a[7]);
		b[7] = b[6] % 50;

		a[8] = b[7] / 10;
		System.out.println("10원짜리" + a[8]);
		b[8] = b[7] % 10;

		// 반복문 배열 이용

		int[] jan2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		int[] money = { 0, 50000, 10000, 5000, 1000, 500, 100, 50, 10 };
		jan = dan - won;
		System.out.println(jan);
		for (int i = 1; i <= 8; i++) {

			jan2[i] = jan / money[i];
			jan = jan % money[i];

			System.out.println(money[i] + "원" + jan2[i] + "장");

			
			
		}

	}
}
/*
class JandonVO {

	private int money;
	private int pay;
	
	private int[] jan2a = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	private int[] moneya = { 0, 50000, 10000, 5000, 1000, 500, 100, 50, 10 };

	public JandonVO() {}
	public JandonVO(int money, int pay ){this.money=money;
	this.pay=pay;
	
	public void setMoney(int money;){this.money=money;}
		}
	}
class JandoonService{
	
	
	
	
}*/